﻿using System.Web.UI;
using System.Web.UI.WebControls;

namespace JQuery.WebKit
{
    public class JValidationMessage : Label
    {
        public JValidationType MessageType { get; set; }

        public JValidationMessage()
            : this("Message", JValidationType.Info)
        {
        }

        public JValidationMessage(string message, JValidationType messageType)
        {
            Text = message;
            MessageType = messageType;
        }

        public override void RenderControl(HtmlTextWriter writer)
        {
            switch (MessageType)
            {
                case JValidationType.Info:
                    this.CssClass = "validationMessage validationInfo";
                    break;
                case JValidationType.Warning:
                    this.CssClass = "validationMessage validationWarning";
                    break;
                case JValidationType.Error:
                    this.CssClass = "validationMessage validationError";
                    break;
                default:
                    break;
            }
            base.RenderControl(writer);
        }
    }
}
